package com.imiku.controller;

import com.alibaba.fastjson.JSONObject;
import com.imiku.model.TypeInfo;
import com.imiku.service.TypeInfoService;
import com.imiku.utils.JsonUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/type")
public class TypeInfoController {

    @Autowired
    private TypeInfoService typeInfoService;

    @RequestMapping("/list")
    public String list(){
        List<TypeInfo> list =  typeInfoService.findAllType();
        JSONObject jsonObject = JsonUtils.getJsonObject(1,"成功");
        jsonObject.put("list", list);
        return jsonObject.toJSONString();
    }
}
